﻿using System.Linq.Expressions;
using System.Linq.PageList;
using Dyao.Book.Contract;
using Dyao.Book.Entity;

namespace Dyao.Book.Repository.Abstractions
{
    public interface IBookSourceWarehouseRepository : IDataRepository<BookSourceWarehouseEntity>
    {

        /// <summary>
        /// 批量更新
        /// </summary>
        /// <param name="entities">实体</param>
        /// <param name="updateSelector">选择器</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task BulkUpdateAsync(IEnumerable<BookSourceWarehouseEntity> entities, Expression<Func<BookSourceWarehouseEntity, object>> updateSelector, CancellationToken cancellationToken = default);

        /// <summary>
        /// 分页获取书源信息
        /// </summary>
        /// <param name="pageFilter">分页筛选器</param>
        /// <param name="cancellationToken">取消操作的通知</param>
        /// <returns>书籍信息</returns>
        Task<IPageList<BookSourceWarehouseEntity>> GetPageListAsync(IPageFilter<BookSourceSettingFilterDto> pageFilter, CancellationToken cancellationToken = default);

        /// <summary>
        /// 获取所有列表集合
        /// </summary>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task<List<BookSourceWarehouseDto>> GetAllListAsync(CancellationToken cancellationToken);

        /// <summary>
        /// 根据Id获取书源列表
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="ids">编号</param>
        /// <param name="selector">选择器</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task<List<T>> GetListByIdsAsync<T>(List<string> ids, Expression<Func<BookSourceWarehouseEntity, T>> selector, CancellationToken cancellationToken);

        /// <summary>
        /// 根据Id获取实体
        /// </summary>
        /// <param name="id">编号</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task<BookSourceWarehouseEntity> GetByIdAsync(string id, CancellationToken cancellationToken);
    }
}
